import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
// 引入语言包插件
import i18n from './i18n'

// api拦截器，模拟考勤数据
import '@/mock'

// set ElementUI lang to EN
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false

// 自定义指令，修改图片加载错误
import { imgerr } from '@/directives'
Vue.directive('imgerr', imgerr)

// 注册全局组件
import components from '@/components'
Vue.use(components)

// 全局过滤器
import * as filterList from '@/filters'
for (const key in filterList) {
  Vue.filter(key, filterList[key])
}

// 混入
import mixin from './mixin'
Vue.mixin(mixin)

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
